package com.kykj.kykjyzw.service.impl;

import com.kykj.kykjyzw.dao.AddressDao;
import com.kykj.kykjyzw.entity.AddressEntity;
import com.kykj.kykjyzw.service.AddressService;
import com.kykj.kykjyzw.vo.AddressVo;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AddressServiceImpl  implements AddressService {
    @Resource
    AddressDao addressDao;

    /**
     * 获取总数
     * @param uid 用户id
     * @param start 开始位置
     * @param limit 每页行数
     * @return int：总数
     */
    @Override
    public List<AddressEntity> getAddressListByUser(int uid, int start, int limit) {
        return addressDao.getAddressListByUser(uid, start, limit);
    }

    /**
     * 获取总数
     * @param uid 用户id
     * @param start 开始位置
     * @param limit 每页行数
     * @return int：总数
     */
    @Override
    public int getAddressCountByUser(int uid, int start, int limit) {
        return addressDao.getAddressCountByUser(uid,start,limit);
    }

    /**
     * 获取总数（无条件）
     * @return int
     */
    @Override
    public int getAddressCount() {
        return addressDao.getAddressCount();
    }

    @Override
    public int addAddress(AddressVo addressVo) {
        return addressDao.addAddress(addressVo);
    }

    /**
     * 修改地址
     * @param addressVo
     * @return
     */
    @Override
    public int changeAddress(AddressVo addressVo) {
        return addressDao.changeAddress(addressVo);
    }

    /**
     * 删除地址
     * @param addressid 地址id
     * @return int
     */
    @Override
    public int delAddress(int addressid) {
        return addressDao.delAddress(addressid);
    }
}
